﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Filmek
{
    public class Kosar
    {
		public int felhID;
        public int n;
        public int[,] idk = new int[20,2];
		private MyReader myReader;

		public Kosar(int id)
		{
			n = 0;
			bool error = false;
			myReader = new MyReader(ref error);
			felhID = id;
		}

        public void addKosar(int id)
		{
            int i = 0;
            for ( i = 0; i < n && idk[i,0] != id; i++) ;
            if (i == n)
            {
                idk[i,0] = id;
                idk[i,1] = 1;
                n++;
            }
            else
            {
                idk[i,1]++;
            }
        }

        

		public int getVegOsszeg()
		{
			int vegOsszeg = 0;

            for (int i = 0; i < n; i++)
               vegOsszeg += myReader.getFilmPriceByID(idk[i,0]) * idk[i,1];

			return vegOsszeg;
		}

    }
}
